home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
PInterfaces
/
TextUtils.p
< prev
next >
Wrap
Text File
|
1996-05-01
|
8KB
|
266 lines
{
File: TextUtils.p
Contains: Text Utilities Interfaces.
Version: Technology: System 7.0 through System 8
Release: Universal Interfaces 3.0d3 on Copland DR1
Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
}
{$IFC UNDEFINED UsingIncludes}
{$SETC UsingIncludes := 0}
{$ENDC}
{$IFC NOT UsingIncludes}
UNIT TextUtils;
INTERFACE
{$ENDC}
{$IFC UNDEFINED __TEXTUTILS__}
{$SETC __TEXTUTILS__ := 1}
{$I+}
{$SETC TextUtilsIncludes := UsingIncludes}
{$SETC UsingIncludes := 1}
{$IFC UNDEFINED __TYPES__}
{$I Types.p}
{$ENDC}
{$IFC UNDEFINED __SCRIPT__}
{$I Script.p}
{$ENDC}
{$IFC UNDEFINED __OSUTILS__}
{$I OSUtils.p}
{$ENDC}
{$IFC UNDEFINED __TEXTOBJECTS__}
{$I TextObjects.p}
{$ENDC}
{$IFC UNDEFINED __NUMBERFORMATTING__}
{$I NumberFormatting.p}
{$ENDC}
{$IFC UNDEFINED __TIMEOBJECTS__}
{$I TimeObjects.p}
{$ENDC}
{$IFC UNDEFINED __STRINGCOMPARE__}
{$I StringCompare.p}
{$ENDC}
{$PUSH}
{$ALIGN MAC68K}
{$LibExport+}
{
Here are the current System 7 routine names and the translations to the older forms.
Please use the newer forms in all new code and migrate the older names out of existing
code as maintainance permits.
NEW NAME OLD NAMEs OBSOLETE FORM (no script code)
FindScriptRun
FindWordBreaks NFindWord, FindWord
GetIndString
GetString
Munger
NewString
SetString
StyledLineBreak
TruncString
TruncText
UpperString ($A054) UprString, UprText
UppercaseText SCUpperText (a only) UpperText ($A456)
LowercaseText LwrString, LowerText, LwrText ($A056)
StripDiacritics StripText ($A256)
UppercaseStripDiacritics StripUpperText ($A656)
}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
{ Type for truncWhere parameter in TruncString, TruncText }
TYPE
TruncCode = INTEGER;
CONST
{ Constants for truncWhere argument in TruncString and TruncText }
truncEnd = 0; { Truncate at end }
truncMiddle = $4000; { Truncate in middle }
smTruncEnd = 0; { Truncate at end - obsolete }
smTruncMiddle = $4000; { Truncate in middle - obsolete }
{ Constants for TruncString and TruncText results }
notTruncated = 0; { No truncation was necessary }
truncated = 1; { Truncation performed }
truncErr = -1; { General error }
smNotTruncated = 0; { No truncation was necessary - obsolete }
smTruncated = 1; { Truncation performed - obsolete }
smTruncErr = -1; { General error - obsolete }
TYPE
StyledLineBreakCode = SInt8;
CONST
smBreakWord = 0;
smBreakChar = 1;
smBreakOverflow = 2;
TYPE
ScriptRunStatusPtr = ^ScriptRunStatus;
ScriptRunStatus = RECORD
script: SInt8;
runVariant: SInt8;
END;
BreakTablePtr = ^BreakTable;
BreakTable = RECORD
charTypes: PACKED ARRAY [0..255] OF CHAR;
tripleLength: INTEGER;
triples: ARRAY [0..0] OF INTEGER;
END;
NBreakTablePtr = ^NBreakTable;
NBreakTable = RECORD
flags1: SInt8;
flags2: SInt8;
version: INTEGER;
classTableOff: INTEGER;
auxCTableOff: INTEGER;
backwdTableOff: INTEGER;
forwdTableOff: INTEGER;
doBackup: INTEGER;
length: INTEGER; { length of NBreakTable }
charTypes: PACKED ARRAY [0..255] OF CHAR;
tables: ARRAY [0..0] OF INTEGER;
END;
{ The following functions are new names that work on 68k and PowerPC }
FUNCTION Munger(h: Handle; offset: LONGINT; ptr1: UNIV Ptr; len1: LONGINT; ptr2: UNIV Ptr; len2: LONGINT): LONGINT;
{$IFC NOT GENERATINGCFM}
INLINE $A9E0;
{$ENDC}
FUNCTION NewString(theString: Str255): StringHandle;
{$IFC NOT GENERATINGCFM}
INLINE $A906;
{$ENDC}
PROCEDURE SetString(theString: StringHandle; strNew: Str255);
{$IFC NOT GENERATINGCFM}
INLINE $A907;
{$ENDC}
FUNCTION GetString(stringID: INTEGER): StringHandle;
{$IFC NOT GENERATINGCFM}
INLINE $A9BA;
{$ENDC}
PROCEDURE GetIndString(VAR theString: Str255; strListID: INTEGER; index: INTEGER);
FUNCTION StyledLineBreak(textPtr: Ptr; textLen: LONGINT; textStart: LONGINT; textEnd: LONGINT; flags: LONGINT; VAR textWidth: Fixed; VAR textOffset: LONGINT): StyledLineBreakCode;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $821C, $FFFE, $A8B5;
{$ENDC}
FUNCTION TruncString(width: INTEGER; VAR theString: Str255; truncWhere: TruncCode): INTEGER;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $8208, $FFE0, $A8B5;
{$ENDC}
FUNCTION TruncText(width: INTEGER; textPtr: Ptr; VAR length: INTEGER; truncWhere: TruncCode): INTEGER;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $820C, $FFDE, $A8B5;
{$ENDC}
PROCEDURE FindWordBreaks(textPtr: Ptr; textLength: INTEGER; offset: INTEGER; leadingEdge: BOOLEAN; breaks: BreakTablePtr; VAR offsets: OffsetTable; script: ScriptCode);
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $C012, $001A, $A8B5;
{$ENDC}
PROCEDURE LowercaseText(textPtr: Ptr; len: INTEGER; script: ScriptCode);
{$IFC NOT GENERATINGCFM}
INLINE $3F3C, $0000, $2F3C, $800A, $FFB6, $A8B5;
{$ENDC}
PROCEDURE UppercaseText(textPtr: Ptr; len: INTEGER; script: ScriptCode);
{$IFC NOT GENERATINGCFM}
INLINE $3F3C, $0400, $2F3C, $800A, $FFB6, $A8B5;
{$ENDC}
PROCEDURE StripDiacritics(textPtr: Ptr; len: INTEGER; script: ScriptCode);
{$IFC NOT GENERATINGCFM}
INLINE $3F3C, $0200, $2F3C, $800A, $FFB6, $A8B5;
{$ENDC}
PROCEDURE UppercaseStripDiacritics(textPtr: Ptr; len: INTEGER; script: ScriptCode);
{$IFC NOT GENERATINGCFM}
INLINE $3F3C, $0600, $2F3C, $800A, $FFB6, $A8B5;
{$ENDC}
FUNCTION FindScriptRun(textPtr: Ptr; textLen: LONGINT; VAR lenUsed: LONGINT): ScriptRunStatus;
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $820C, $0026, $A8B5;
{$ENDC}
{$ENDC}
{ FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
{$IFC FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
PROCEDURE UpperString(VAR theString: Str255; diacSensitive: BOOLEAN);
{ Old routine name but no new names are mapped to it: }
PROCEDURE UprText(textPtr: Ptr; len: INTEGER);
{$IFC NOT GENERATINGCFM}
INLINE $301F, $205F, $A054;
{$ENDC}
{$ENDC}
{ FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE }
{
The following functions are old names, but are required for PowerPC builds
because InterfaceLib exports these names, instead of the new ones.
}
{$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
PROCEDURE FindWord(textPtr: Ptr; textLength: INTEGER; offset: INTEGER; leadingEdge: BOOLEAN; breaks: BreakTablePtr; VAR offsets: OffsetTable);
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $8012, $001A, $A8B5;
{$ENDC}
PROCEDURE NFindWord(textPtr: Ptr; textLength: INTEGER; offset: INTEGER; leadingEdge: BOOLEAN; nbreaks: NBreakTablePtr; VAR offsets: OffsetTable);
{$IFC NOT GENERATINGCFM}
INLINE $2F3C, $8012, $FFE2, $A8B5;
{$ENDC}
PROCEDURE LwrText(textPtr: Ptr; len: INTEGER);
{$IFC NOT GENERATINGCFM}
INLINE $301F, $205F, $A056;
{$ENDC}
PROCEDURE LowerText(textPtr: Ptr; len: INTEGER);
{$IFC NOT GENERATINGCFM}
INLINE $301F, $205F, $A056;
{$ENDC}
PROCEDURE StripText(textPtr: Ptr; len: INTEGER);
{$IFC NOT GENERATINGCFM}
INLINE $301F, $205F, $A256;
{$ENDC}
PROCEDURE UpperText(textPtr: Ptr; len: INTEGER);
{$IFC NOT GENERATINGCFM}
INLINE $301F, $205F, $A456;
{$ENDC}
PROCEDURE StripUpperText(textPtr: Ptr; len: INTEGER);
{$IFC NOT GENERATINGCFM}
INLINE $301F, $205F, $A656;
{$ENDC}
{$ENDC}
{ FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
{$IFC NOT OLDROUTINELOCATIONS }
{$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
PROCEDURE C2PStrProc(aStr: UNIV Ptr);
FUNCTION C2PStr(cString: UNIV Ptr): StringPtr;
PROCEDURE P2CStrProc(aStr: StringPtr);
FUNCTION P2CStr(pString: StringPtr): Ptr;
{$ENDC}
{ FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
{$ENDC}
{ !OLDROUTINELOCATIONS }
{$ALIGN RESET}
{$POP}
{$SETC UsingIncludes := TextUtilsIncludes}
{$ENDC} {__TEXTUTILS__}
{$IFC NOT UsingIncludes}
END.
{$ENDC}